package personal.study.bl;

import java.sql.Connection;
import java.util.Collection;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

import personal.study.db.DBUserTask;
import personal.study.form.UserTaskForm;
import personal.study.util.DBConnection;

public class BLUserTaskAction {
	private static Log log = LogFactory.getLog(BLUserTaskAction.class);

	public boolean insert(UserTaskForm userTaskForm) throws Exception{
		boolean result = false;
		Connection con = null;
		try{
			con = DBConnection.getCon();
			DBUserTask dbUserTask = new DBUserTask();
			result = dbUserTask.insert(con, userTaskForm);
		}catch(Exception e){
			log.error(e.getMessage());
		}
		return result;
	}
	
	public boolean delete(String conditions) throws Exception{
		boolean result = false;
		Connection con = null;
		try{
			con = DBConnection.getCon();
			DBUserTask dbUserTask = new DBUserTask();
			result = dbUserTask.delete(con, conditions);
		}catch(Exception e){
			log.error(e.getMessage());
		}
		return result;
	}
	
	public Collection<UserTaskForm> findByConditions(String conditions) throws Exception{
		Collection<UserTaskForm> col = null;
		Connection con = null;
		try{
			con = DBConnection.getCon();
			DBUserTask dbUserTask = new DBUserTask();
			col = dbUserTask.findByConditions(con, conditions);
		}catch(Exception e){
			log.error(e.getMessage());
		}
		return col;
	}
}
